Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active March 23, 2020 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/ff3056b40e4e59262a4fe9f25f0810e9 to your computer and use it in GitHub Desktop.
Save kenwebb/ff3056b40e4e59262a4fe9f25f0810e9 to your computer and use it in GitHub Desktop.
Haskell prelude - xhprelude.js
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Mon Mar 23 2020 16:43:07 GMT-0400 (Eastern Daylight Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Haskell prelude - xhprelude.js
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: ff3056b40e4e59262a4fe9f25f0810e9
Keywords:
My Notes
--------
March 23, 2020
http://127.0.0.1:8888/Xholon.html?app=Haskell prelude - xhprelude.js&src=lstr&gui=clsc&jslib=ramda.min,xhprelude
http://127.0.0.1:8888/Xholon.html?app=Haskell%20prelude%20-%20xhprelude.js&src=lstr&gui=clsc&jslib=ramda.min,xhprelude
]]></Notes>
<_-.XholonClass>
<PhysicalSystem/>
<Xhprelude/>
</_-.XholonClass>
<xholonClassDetails>
</xholonClassDetails>
<PhysicalSystem>
<Xhprelude/>
</PhysicalSystem>
<Xhpreludebehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var me, RP, beh = {
postConfigure: function() {
me = this.cnode.parent();
RP = $wnd.RP || $wnd.xh.RP;
this.dotest();
},
act: function() {
//
},
dotest: function() {
me.println("Testing xhprelude from workbook:");
me.println(RP.abs(33)); // 33
me.println(RP.abs(-33)); // 33
me.println(RP.all((x => x < 11), [1,2,3])); // true
me.println(RP.all((x => x < 11), [1,2,3,11])); // false
me.println(RP.and([true,true])); // true
me.println(RP.and([true,true,false])); // false
me.println(RP.and([true,true,false,true])); // false
me.println(RP.and([])); // true
me.println(RP.any((x => x < 11), [1,2,3,11])); // true
me.println(RP.atan(1)); // 0.7853981633974483
me.println(RP.break((x => x == 2), [1, 2, 3, 1, 2, 3])); // [[1], [2, 3, 1, 2, 3]]
me.println(RP.ceiling(33.4)); // 34
me.println(RP.chr(65)); // "A"
me.println(RP.compare('x', 'x')); // "EQ"
me.println(RP.compare("zebra", "ardvark")); // "GT"
me.println(RP.compare(13, 27)); // "LT"
me.println(RP.concat([[1,2,3], [4], [], [5,6,7,8]])); // [1, 2, 3, 4, 5, 6, 7, 8]
me.println(RP.concatMap((n => Number(n).toString()), [1,2,3,4])); // [ "1", "2", "3", "4" ] TODO should be "1234"; but consider the diffs betwteen JS and Haskell
}
}
//# sourceURL=Xhpreludebehavior.js
]]></Xhpreludebehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Xhprelude</title>
<rect id="PhysicalSystem/Xhprelude" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Xhpreludebehavior</title>
<rect id="PhysicalSystem/Xhprelude/Xhpreludebehavior" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment