Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

sparse-rec-to-fixed-block

	sparse-rec-to-fixed-block: func [
		rec [block!]
		col-names [block!] "All column names in full schema"
	][
		if not all-words? col-names [alert join "sparse-rec-to-fixed-block: col-names has non-word values: " mold col-names]
		collect/only val [
			foreach name col-names [
				val: attempt [first select/skip rec name 2]
			]
		]
	]

sparse-rec?

	; Like named-fields?, this func can't guarantee that a record is really
	; a sparse rec; it can only tell us if it's not.
	sparse-rec?: func [
		rec [block!]
		col-names [block!] "All column names in full schema"
	][
		if not all-words? col-names [alert join "sparse-rec?: col-names has non-word values: " mold col-names]
		all [
			named-fields? rec
			(length? rec) <> (2 * length? col-names) 
		]
	]
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS